package com.fl.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fl.mapper.CommMapper;

@Service	
public class BaseService {
	@Autowired
	private CommMapper CommMapper;
	public List<Map<String,Object>> Query(String SqlStatement)
	{
		return this.CommMapper.NativeSqlQuery(SqlStatement.toLowerCase());
		
	}
	public Map<String,Object> QueryMap(String SqlStatement)
	{
		return this.CommMapper.NativeSqlQueryMap(SqlStatement.toLowerCase());
		
	}
	public Object QueryObject(String SqlStatement)
	{
		return this.CommMapper.NativeSqlQueryObject(SqlStatement.toLowerCase());
		
	}
	
	public double QueryDouble(String SqlStatement)
	{
		Object o=this.QueryObject(SqlStatement);
		
		if(o!=null)
		{
			return Double.parseDouble(o.toString());
		}
		return 0d;
	}
	public String QueryString(String SqlStatement)
	{
		Object o=this.QueryObject(SqlStatement);
		
		if(o!=null)
		{
			return o.toString();
		}
		return "";
	}
	
	
	public int QueryInt(String SqlStatement)
	{
		
		Object o=this.QueryObject(SqlStatement);
		
		if(o!=null)
		{
			return Integer.parseInt(o.toString());
		}
		return 0;
		
	}
	
	
	
	
	
	
	
	
	
	
	public Object QueryList(String SqlStatement)
	{
		return this.CommMapper.NativeSqlQueryList(SqlStatement.toLowerCase());
		
	}
	public void Update(String SqlStatement)
	{
		this.CommMapper.NativeUpdate(SqlStatement);
		
	}

}
